package com.aat.modle.renzhengheyi;

import java.io.FileInputStream;

import com.aat.modle.renzhengheyi.kalala.Base64;

public class TestApi {

	public static void main(String[] args) throws Exception {
		String appId = "cedf369000fa429b95b6b976f6eb3103";
		String token = "44fb66b06a76aca1beeee28b2b969e10";
		String name = "毛家亮";
		String idNumber = "342224198901241273";
		String startDate = "20071114";
		String endDate = "20171114";
		String idIssued = "";
		String bundleId = "com.umessage.edu";

		//
		FileInputStream fis = new FileInputStream("/Users/dxy/test.jpg");
		byte[] data = new byte[fis.available()];
		fis.read(data);
		fis.close();
		String portrait = Base64.encode(data);

		RenzhyApi.postServer(name, idNumber, idIssued, startDate, endDate, token, appId, bundleId, portrait);
		//
	}

	public static String unicode2String(String unicode) {

		StringBuffer string = new StringBuffer();

		String[] hex = unicode.split("\\\\u");

		for (int i = 1; i < hex.length; i++) {

			// 转换出每一个代码点
			int data = Integer.parseInt(hex[i], 16);

			// 追加成string
			string.append((char) data);
		}

		return string.toString();
	}

}
